<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>gui2py: Fichero Fuente build/lib.linux-x86_64-2.7/gui/tools/toolbox.py</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../edit.gif"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">gui2py
   &#160;<span id="projectnumber">0.9.3</span>
   </div>
   <div id="projectbrief">Interfaz de desarrollo de aplicaciones graficas</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generado por Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Buscar');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Página&#160;principal</span></a></li>
      <li><a href="../../namespaces.html"><span>Paquetes</span></a></li>
      <li><a href="../../annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="../../files.html"><span>Archivos</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Buscar" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>Lista&#160;de&#160;archivos</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Todo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Clases</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Archivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Funciones</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Propiedades</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">toolbox.py</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py.html">Ir a la documentación de este archivo.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html">    1</a></span>&#160;<span class="comment">#!/usr/bin/python</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"># -*- coding: utf-8 -*-</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="stringliteral">&quot;Visual Toolbox to drag &amp; drop gui2py&#39;s components (using wx AuiToolbar)&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div>
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a4f1055ec03f174fc77f5d4468acb70d0">    6</a></span>&#160;__author__ = <span class="stringliteral">&quot;Mariano Reingart (reingart@gmail.com)&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#adcba15dd2d07a41c0fe0b68c83f0a6c3">    7</a></span>&#160;__copyright__ = <span class="stringliteral">&quot;Copyright (C) 2013- Mariano Reingart&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#ac0f060613e564cf5930a552942e02c26">    8</a></span>&#160;__license__ = <span class="stringliteral">&quot;LGPL 3.0&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"># some parts where inspired or borrowed from wxPython examples</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">import</span> wx</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="keyword">import</span> os, sys</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">import</span> gui</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keyword">from</span> gui <span class="keyword">import</span> registry</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keywordflow">try</span>:</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <span class="keyword">from</span> agw <span class="keyword">import</span> aui</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="keyword">from</span> agw.aui <span class="keyword">import</span> aui_switcherdialog <span class="keyword">as</span> ASD</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keywordflow">except</span> ImportError: <span class="comment"># if it&#39;s not there locally, try the wxPython lib.</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">import</span> wx.lib.agw.aui <span class="keyword">as</span> aui</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="keyword">from</span> wx.lib.agw.aui <span class="keyword">import</span> aui_switcherdialog <span class="keyword">as</span> ASD</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#ad823199727188dfe12c9dc70b18794f5">   28</a></span>&#160;DEBUG = <span class="keyword">False</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html">   31</a></span>&#160;<span class="keyword">class </span><a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html">ToolBox</a>(aui.AuiToolBar):</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="stringliteral">&quot;AUI ToolBar showing gui controls, capable of Drag &amp; Drop&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    </div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2eef69d35bed45e7f611eb3f6410ad7c">   34</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2eef69d35bed45e7f611eb3f6410ad7c">__init__</a>(self, parent):</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;        aui.AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize,</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                                 agwStyle=aui.AUI_TB_OVERFLOW | aui.AUI_TB_VERTICAL | aui.AUI_TB_TEXT)</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2f4460e4672dcadd10a74025b8ee05c4">   38</a></span>&#160;        self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2f4460e4672dcadd10a74025b8ee05c4">default_tlw</a> = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">   39</a></span>&#160;        self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#aaf5161c8489d7fcf4e2e6d774c43b357">desinger</a> = self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">inspector</a> = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        prepend_items, append_items = [],[]</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        self.SetToolBitmapSize(wx.Size(48, 48))</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;        <span class="comment">#self.AddSimpleTool(ID_SampleItem+30, &quot;Test&quot;, wx.ArtProvider.GetBitmap(wx.ART_ERROR))</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="comment">#self.AddSeparator()</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        <span class="comment"># store assoc of wx ID -&gt; gui control (for drag&amp;drop)</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">   46</a></span>&#160;        self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">menu_ctrl_map</a> = {}</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        </div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        <span class="comment"># create a toolbar item for each control (ignore those that have no image)</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">for</span> name, ctrl <span class="keywordflow">in</span> sorted(registry.CONTROLS.items(), </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                                 key=<span class="keyword">lambda</span> it: registry.ALL.index(it[0])):</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            <span class="keywordflow">if</span> ctrl._image:</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                menu_id = wx.NewId()</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">menu_ctrl_map</a>[menu_id] = ctrl</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                tool = self.AddSimpleTool(menu_id, name, ctrl._image.GetBitmap())</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                self.Bind(wx.EVT_MENU, self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a3b098cd83b8b5f77eb48e8100fc257b8">tool_click</a>, id=menu_id)</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                <span class="comment"># TODO: add meta info to classify controls</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;                <span class="keywordflow">if</span> <span class="stringliteral">&#39;Menu&#39;</span> <span class="keywordflow">in</span> ctrl._meta.name:</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                    append_items.append(tool)</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="comment"># Handle &quot;A drag operation involving a toolbar item has started&quot;</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        self.Bind(aui.EVT_AUITOOLBAR_BEGIN_DRAG, self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2ac2e2059f00a3435e5836e45968d43d">start_drag_opperation</a>)</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="comment"># this can be useful in the future (TODO: multiple columns or groups)</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        self.SetCustomOverflowItems(prepend_items, append_items)</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        self.Realize()</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a3b098cd83b8b5f77eb48e8100fc257b8">   67</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a3b098cd83b8b5f77eb48e8100fc257b8">tool_click</a>(self, evt):</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        <span class="stringliteral">&quot;Event handler tool selection (just add to default handler)&quot;</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        <span class="comment"># get the control</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        ctrl = self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">menu_ctrl_map</a>[evt.GetId()]</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        <span class="comment"># create the control on the parent:</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        <span class="keywordflow">if</span> self.inspector.selected_obj:</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            <span class="comment"># find the first parent drop target</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;            parent = self.inspector.selected_obj</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            <span class="keywordflow">while</span> parent.drop_target <span class="keywordflow">is</span> <span class="keywordtype">None</span> <span class="keywordflow">and</span> parent.get_parent():</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;                parent = parent.get_parent()</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            <span class="comment"># create the new object</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            obj = ctrl(parent, </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                       name=<span class="stringliteral">&quot;%s_%s&quot;</span> % (ctrl._meta.name.lower(), wx.NewId()), </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                       pos=(0, 0), designer=self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a371817c9efe1db5e2d05d0f972c772e1">designer</a>)</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            <span class="comment"># associate the object with the toolbox:</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;            <span class="keywordflow">if</span> obj._meta.container:</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                dt = <a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(obj, self.inspector.root_obj, </div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                                       designer=self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a371817c9efe1db5e2d05d0f972c772e1">designer</a>, </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                                       inspector=self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">inspector</a>)</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                obj.drop_target = dt</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        <span class="comment"># fix width and height if default is not visible</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        w, h = obj.size</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">if</span> w &lt;= 10:</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            obj.width = 100</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keywordflow">if</span> h &lt;= 10:</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            obj.height = 20</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        <span class="comment"># update the object at the inspector (to show the new control)</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        <span class="keywordflow">if</span> self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">inspector</a>:</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;            self.inspector.load_object(self.inspector.root_obj)  <span class="comment"># refresh tree</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;            self.inspector.inspect(obj)</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        </div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2ac2e2059f00a3435e5836e45968d43d">  101</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2ac2e2059f00a3435e5836e45968d43d">start_drag_opperation</a>(self, evt):</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <span class="stringliteral">&quot;Event handler for drag&amp;drop functionality&quot;</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    </div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <span class="comment"># get the control</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        ctrl = self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">menu_ctrl_map</a>[evt.GetToolId()]</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        <span class="comment"># create our own data format and use it in a custom data object</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        ldata = wx.CustomDataObject(<span class="stringliteral">&quot;gui&quot;</span>)</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        ldata.SetData(ctrl._meta.name)      <span class="comment"># only strings are allowed!</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        <span class="comment"># Also create a Bitmap version of the drawing</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        bmp = ctrl._image.GetBitmap()</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="comment"># Now make a data object for the bitmap and also a composite</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        <span class="comment"># data object holding both of the others.</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        bdata = wx.BitmapDataObject(bmp)</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        data = wx.DataObjectComposite()</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        data.Add(ldata)</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        data.Add(bdata)</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        <span class="comment"># And finally, create the drop source and begin the drag</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="comment"># and drop opperation</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        dropSource = wx.DropSource(self)</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        dropSource.SetData(data)</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;Begining DragDrop\n&quot;</span>)</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        result = dropSource.DoDragDrop(wx.Drag_AllowMove)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;DragDrop completed: %d\n&quot;</span> % result)</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordflow">if</span> result == wx.DragMove:</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            <span class="keywordflow">if</span> DEBUG: <span class="keywordflow">print</span> <span class="stringliteral">&quot;dragmove!&quot;</span></div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            self.Refresh()</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a4f00200158e6d5ce2b07fc9a5b241c80">  133</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a4f00200158e6d5ce2b07fc9a5b241c80">set_default_tlw</a>(self, tlw, designer, inspector):</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        <span class="stringliteral">&quot;track default top level window for toolbox menu default action&quot;</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a371817c9efe1db5e2d05d0f972c772e1">  135</a></span>&#160;        self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a371817c9efe1db5e2d05d0f972c772e1">designer</a> = designer</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        self.<a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">inspector</a> = inspector</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">  139</a></span>&#160;<span class="keyword">class </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(wx.PyDropTarget):</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="stringliteral">&quot;Target of Drag&amp;Drop operation (will create the dropped control)&quot;</span></div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    </div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b0e87f1575762eac9c6b4b56227b46">  142</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b0e87f1575762eac9c6b4b56227b46">__init__</a>(self, window, root, designer=None, inspector=None):</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        wx.PyDropTarget.__init__(self)</div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ac2cc747bbdaee507971d8ec02acc9f25">  144</a></span>&#160;        self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ac2cc747bbdaee507971d8ec02acc9f25">dv</a> = window</div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#aed72dee747df0ffbf61057dc95276867">  145</a></span>&#160;        self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#aed72dee747df0ffbf61057dc95276867">root</a> = root                <span class="comment"># root item to show at the inspector</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">  146</a></span>&#160;        self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">designer</a> = designer  <span class="comment"># used in design mode (set special handlers)</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">  147</a></span>&#160;        self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">inspector</a> = inspector</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        <span class="comment"># specify the type of data we will accept</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b2c14ed65936390979a19322aa7caa">  150</a></span>&#160;        self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b2c14ed65936390979a19322aa7caa">data</a> = wx.CustomDataObject(<span class="stringliteral">&quot;gui&quot;</span>)</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        self.SetDataObject(self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b2c14ed65936390979a19322aa7caa">data</a>)</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="comment"># some virtual methods that track the progress of the drag</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a249e0ad6c42cb1f1bb52873d11e0f603">  154</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a249e0ad6c42cb1f1bb52873d11e0f603">OnEnter</a>(self, x, y, d):</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;OnEnter: %d, %d, %d\n&quot;</span> % (x, y, d))</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        <span class="keywordflow">return</span> d</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#af001666aae43777ecec0408da1217faf">  158</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#af001666aae43777ecec0408da1217faf">OnLeave</a>(self):</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;OnLeave\n&quot;</span>)</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a81b38aab33b17c43ad3912c8b0038685">  161</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a81b38aab33b17c43ad3912c8b0038685">OnDrop</a>(self, x, y):</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;OnDrop: %d %d\n&quot;</span> % (x, y))</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">True</span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;</div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae4408c210133fa96bb5d91fbe42c7154">  165</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae4408c210133fa96bb5d91fbe42c7154">OnDragOver</a>(self, x, y, d):</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        <span class="comment">#self.log.WriteText(&quot;OnDragOver: %d, %d, %d\n&quot; % (x, y, d))</span></div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        <span class="comment"># The value returned here tells the source what kind of visual</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        <span class="comment"># feedback to give.  For example, if wxDragCopy is returned then</span></div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        <span class="comment"># only the copy cursor will be shown, even if the source allows</span></div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        <span class="comment"># moves.  You can use the passed in (x,y) to determine what kind</span></div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;        <span class="comment"># of feedback to give.  In this case we return the suggested value</span></div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        <span class="comment"># which is based on whether the Ctrl key is pressed.</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        <span class="keywordflow">if</span> self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">inspector</a>:</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            self.inspector.highlight(self.dv.wx_obj)   <span class="comment"># show the possible drop target</span></div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        <span class="keywordflow">return</span> d</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <span class="comment"># Called when OnDrop returns True.  We need to get the data and</span></div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="comment"># do something with it.</span></div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a67b2cbade8d7e607c339e25ae61650ca">  182</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a67b2cbade8d7e607c339e25ae61650ca">OnData</a>(self, x, y, d):</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;        <span class="keywordflow">if</span> DEBUG: print(<span class="stringliteral">&quot;OnData: %d, %d, %d\n&quot;</span> % (x, y, d))</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;        <span class="comment"># copy the data from the drag source to our data object</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;        <span class="keywordflow">if</span> self.GetData():</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;            <span class="comment"># convert it back to a list of lines and give it to the viewer</span></div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;            ctrl_name = self.data.GetData()</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;            ctrl = registry.CONTROLS[ctrl_name]</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <span class="comment"># create the control on the parent:</span></div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            obj = ctrl(self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ac2cc747bbdaee507971d8ec02acc9f25">dv</a>, </div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                       name=<span class="stringliteral">&quot;%s_%s_%s&quot;</span> % (ctrl_name.lower(), x, y), </div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                       pos=(x, y), designer=self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">designer</a>)</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            <span class="comment"># set default dimensions (width and height determined by wx):</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;            <span class="keywordflow">if</span> hasattr(obj, <span class="stringliteral">&quot;pos&quot;</span>):     <span class="comment"># only Controls</span></div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;                obj.left, obj.top = [<span class="stringliteral">&quot;%spx&quot;</span> % dim <span class="keywordflow">for</span> dim <span class="keywordflow">in</span> obj.pos] </div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;                <span class="comment"># fix width and height if default is not visible</span></div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;                w, h = obj.size</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;                <span class="keywordflow">if</span> w &lt;= 10:</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;                    obj.width = 100</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                <span class="keywordflow">if</span> h &lt;= 10:</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;                    obj.height = 20</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;            <span class="comment"># update the object at the inspector (to show the new control)</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;            <span class="keywordflow">if</span> self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">inspector</a>:</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;                self.inspector.load_object(self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#aed72dee747df0ffbf61057dc95276867">root</a>)</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;                self.inspector.inspect(obj)</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;            <span class="comment"># associate the object with the toolbox:</span></div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            <span class="keywordflow">if</span> obj._meta.container:</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;                dt = <a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(obj, self.inspector.root_obj, </div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                                       designer=self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">designer</a>, </div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;                                       inspector=self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">inspector</a>)</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;                obj.drop_target = dt</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        <span class="comment"># what is returned signals the source what to do</span></div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        <span class="comment"># with the original data (move, copy, etc.)  In this</span></div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        <span class="comment"># case we just return the suggested value given to us.</span></div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;        <span class="keywordflow">return</span> d  </div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"><a class="line" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae3135f53ae36813249c6e8caa7eec6b2">  219</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae3135f53ae36813249c6e8caa7eec6b2">copy</a>(self):</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;        <span class="stringliteral">&quot;Return a copy of the drop target (to avoid wx problems on rebuild)&quot;</span></div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ac2cc747bbdaee507971d8ec02acc9f25">dv</a>, self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#aed72dee747df0ffbf61057dc95276867">root</a>, </div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;                                 self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">designer</a>, self.<a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">inspector</a>)</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;          </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="comment"># Helper functions:</span></div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;</div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a2e61b2d9a49e1d06836d805a18f095ab">  227</a></span>&#160;<span class="keyword">def </span><a class="code" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a2e61b2d9a49e1d06836d805a18f095ab">set_drop_target</a>(obj, root, designer, inspector):</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    <span class="stringliteral">&quot;Recursively create and set the drop target for obj and childs&quot;</span></div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    <span class="keywordflow">if</span> obj._meta.container:</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        dt = <a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(obj, root, designer=designer, </div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;                                          inspector=inspector)</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        obj.drop_target = dt</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    <span class="keywordflow">for</span> child <span class="keywordflow">in</span> obj:</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;        <a class="code" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a2e61b2d9a49e1d06836d805a18f095ab">set_drop_target</a>(child, root, designer, inspector)</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;<span class="keywordflow">if</span> __name__ == <span class="stringliteral">&#39;__main__&#39;</span>:</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;    <span class="keyword">import</span> sys,os</div>
<div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a190a8a7d58790319a8d2ba5952686015">  239</a></span>&#160;    app = wx.App()</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    </div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#af41c45a25555fab106068a3b205f1b1b">  241</a></span>&#160;    frame = wx.Frame(<span class="keywordtype">None</span>)  <span class="comment"># create a sample parent frame</span></div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    frame.Show()            <span class="comment"># note: without AUI, this will look ugly</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a1a49186ab737890d105709625abeec44">  243</a></span>&#160;    tb = <a class="code" href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html">ToolBox</a>(frame)     <span class="comment"># create the toolbar</span></div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;    tb.Show()</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    <span class="comment"># create a sample gui window</span></div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    <span class="keyword">from</span> <a class="code" href="../../d7/d42/namespacegui_1_1windows.html">gui.windows</a> <span class="keyword">import</span> Window</div>
<div class="line"><a name="l00248"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a302c98e8b97667330d1f709eeaa5962e">  248</a></span>&#160;    w = Window(title=<span class="stringliteral">&quot;hello world&quot;</span>, name=<span class="stringliteral">&quot;frmTest&quot;</span>, tool_window=<span class="keyword">False</span>, </div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;               resizable=<span class="keyword">True</span>, visible=<span class="keyword">False</span>)</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    w.show()</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    <span class="comment"># set the drop target (where controls will be created)</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#afc34b25560892d078f41d5b8b0ae6e31">  252</a></span>&#160;    dt = <a class="code" href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">ToolBoxDropTarget</a>(w.wx_obj)</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    w.wx_obj.SetDropTarget(dt)</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    app.MainLoop()</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a4f00200158e6d5ce2b07fc9a5b241c80"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a4f00200158e6d5ce2b07fc9a5b241c80">gui.tools.toolbox.ToolBox.set_default_tlw</a></div><div class="ttdeci">def set_default_tlw</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00133">toolbox.py:133</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a2ac2e2059f00a3435e5836e45968d43d"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2ac2e2059f00a3435e5836e45968d43d">gui.tools.toolbox.ToolBox.start_drag_opperation</a></div><div class="ttdeci">def start_drag_opperation</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00101">toolbox.py:101</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_ac2cc747bbdaee507971d8ec02acc9f25"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ac2cc747bbdaee507971d8ec02acc9f25">gui.tools.toolbox.ToolBoxDropTarget.dv</a></div><div class="ttdeci">dv</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00144">toolbox.py:144</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a81b38aab33b17c43ad3912c8b0038685"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a81b38aab33b17c43ad3912c8b0038685">gui.tools.toolbox.ToolBoxDropTarget.OnDrop</a></div><div class="ttdeci">def OnDrop</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00161">toolbox.py:161</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a3b098cd83b8b5f77eb48e8100fc257b8"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a3b098cd83b8b5f77eb48e8100fc257b8">gui.tools.toolbox.ToolBox.tool_click</a></div><div class="ttdeci">def tool_click</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00067">toolbox.py:67</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a21b2c14ed65936390979a19322aa7caa"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b2c14ed65936390979a19322aa7caa">gui.tools.toolbox.ToolBoxDropTarget.data</a></div><div class="ttdeci">data</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00150">toolbox.py:150</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a2eef69d35bed45e7f611eb3f6410ad7c"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2eef69d35bed45e7f611eb3f6410ad7c">gui.tools.toolbox.ToolBox.__init__</a></div><div class="ttdeci">def __init__</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00034">toolbox.py:34</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_aed72dee747df0ffbf61057dc95276867"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#aed72dee747df0ffbf61057dc95276867">gui.tools.toolbox.ToolBoxDropTarget.root</a></div><div class="ttdeci">root</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00145">toolbox.py:145</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a67b2cbade8d7e607c339e25ae61650ca"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a67b2cbade8d7e607c339e25ae61650ca">gui.tools.toolbox.ToolBoxDropTarget.OnData</a></div><div class="ttdeci">def OnData</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00182">toolbox.py:182</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a2f4460e4672dcadd10a74025b8ee05c4"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a2f4460e4672dcadd10a74025b8ee05c4">gui.tools.toolbox.ToolBox.default_tlw</a></div><div class="ttdeci">default_tlw</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00038">toolbox.py:38</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html">gui.tools.toolbox.ToolBoxDropTarget</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00139">toolbox.py:139</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_ae3135f53ae36813249c6e8caa7eec6b2"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae3135f53ae36813249c6e8caa7eec6b2">gui.tools.toolbox.ToolBoxDropTarget.copy</a></div><div class="ttdeci">def copy</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00219">toolbox.py:219</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a33921d9209d2aff4c30b6e2015cfbe34"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a33921d9209d2aff4c30b6e2015cfbe34">gui.tools.toolbox.ToolBox.inspector</a></div><div class="ttdeci">inspector</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00039">toolbox.py:39</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_acf792db8ba43dc30924441ae4264a846"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#acf792db8ba43dc30924441ae4264a846">gui.tools.toolbox.ToolBoxDropTarget.inspector</a></div><div class="ttdeci">inspector</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00147">toolbox.py:147</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_af6228f438ff114a14e71ca5290aaea2e"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#af6228f438ff114a14e71ca5290aaea2e">gui.tools.toolbox.ToolBox.menu_ctrl_map</a></div><div class="ttdeci">menu_ctrl_map</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00046">toolbox.py:46</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a8f44337af845da50bfb55c1d6323af21"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a8f44337af845da50bfb55c1d6323af21">gui.tools.toolbox.ToolBoxDropTarget.designer</a></div><div class="ttdeci">designer</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00146">toolbox.py:146</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_aaf5161c8489d7fcf4e2e6d774c43b357"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#aaf5161c8489d7fcf4e2e6d774c43b357">gui.tools.toolbox.ToolBox.desinger</a></div><div class="ttdeci">desinger</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00039">toolbox.py:39</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html_a371817c9efe1db5e2d05d0f972c772e1"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html#a371817c9efe1db5e2d05d0f972c772e1">gui.tools.toolbox.ToolBox.designer</a></div><div class="ttdeci">designer</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00135">toolbox.py:135</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_ae4408c210133fa96bb5d91fbe42c7154"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#ae4408c210133fa96bb5d91fbe42c7154">gui.tools.toolbox.ToolBoxDropTarget.OnDragOver</a></div><div class="ttdeci">def OnDragOver</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00165">toolbox.py:165</a></div></div>
<div class="ttc" id="namespacegui_1_1tools_1_1toolbox_html_a2e61b2d9a49e1d06836d805a18f095ab"><div class="ttname"><a href="../../db/d4e/namespacegui_1_1tools_1_1toolbox.html#a2e61b2d9a49e1d06836d805a18f095ab">gui.tools.toolbox.set_drop_target</a></div><div class="ttdeci">def set_drop_target</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00227">toolbox.py:227</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a21b0e87f1575762eac9c6b4b56227b46"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a21b0e87f1575762eac9c6b4b56227b46">gui.tools.toolbox.ToolBoxDropTarget.__init__</a></div><div class="ttdeci">def __init__</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00142">toolbox.py:142</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBox_html"><div class="ttname"><a href="../../df/d53/classgui_1_1tools_1_1toolbox_1_1ToolBox.html">gui.tools.toolbox.ToolBox</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00031">toolbox.py:31</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_a249e0ad6c42cb1f1bb52873d11e0f603"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#a249e0ad6c42cb1f1bb52873d11e0f603">gui.tools.toolbox.ToolBoxDropTarget.OnEnter</a></div><div class="ttdeci">def OnEnter</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00154">toolbox.py:154</a></div></div>
<div class="ttc" id="namespacegui_1_1windows_html"><div class="ttname"><a href="../../d7/d42/namespacegui_1_1windows.html">gui.windows</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d6/da3/build_2lib_8linux-x86__64-2_87_2gui_2windows_2____init_____8py_source.html#l00001">__init__.py:1</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget_html_af001666aae43777ecec0408da1217faf"><div class="ttname"><a href="../../d3/d6c/classgui_1_1tools_1_1toolbox_1_1ToolBoxDropTarget.html#af001666aae43777ecec0408da1217faf">gui.tools.toolbox.ToolBoxDropTarget.OnLeave</a></div><div class="ttdeci">def OnLeave</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py_source.html#l00158">toolbox.py:158</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../dir_96a7eeec1342994a7cb0d7fe7902ae74.html">build</a></li><li class="navelem"><a class="el" href="../../dir_3740601ea11ece1a00f9273977396bc4.html">lib.linux-x86_64-2.7</a></li><li class="navelem"><a class="el" href="../../dir_5bcb0661a26d4ce62009196be9ab2e39.html">gui</a></li><li class="navelem"><a class="el" href="../../dir_db0ce0c4ad9189174ab3b319d75f8add.html">tools</a></li><li class="navelem"><a class="el" href="../../d5/d40/build_2lib_8linux-x86__64-2_87_2gui_2tools_2toolbox_8py.html">toolbox.py</a></li>
    <li class="footer">Generado el Domingo, 7 de Diciembre de 2014 18:59:47 para gui2py por
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
